<!-- #layout name=empty -->
<script>
    $(function() {
        var formId = Kooboo.getQueryString("Id");
        Kooboo.Form.getExternalList().then(function(res) {

            if (res.success) {
                var find = _.find(res.model, function(form) {
                    return form.id == formId;
                })

                if (find) {
                    if (find.formType.toLowerCase() == "normal") {
                        location.href = Kooboo.Route.Get(Kooboo.Route.Form.DetailPage, {
                            id: formId
                        })
                    } else {
                        location.href = Kooboo.Route.Get(Kooboo.Route.Form.KooFormPage, {
                            id: formId
                        })
                    }
                } else {
                    window.close();
                }
            }
        })
    })
</script>